/*
 * 作者: 董绘峰
 * 时间: 2017-02-09 
 * 说明：
 * Copyright (c) 2016-2017 中研沃兮
 */

define(function(require) {

	require("jquery");

	var c = require('app/utils/CommonUtils');
	var appInfo = require('app/AppInfo');
	var EventUtils = require('app/utils/EventUtils');
	var action = require('app/action/RoomMiddleFrmAction');
	var APIUtils = require('app/utils/APIUtils');
	
	var info_w = $("#info").width();
	var avatar_w = APIUtils.winW() - info_w;

	$("#avatars").width(avatar_w);
	
	$("#detailsaction").click(function(){
		action.detailsAction();
	});
	
	//监听获取msg-login,logout事件，如果有用户登陆则添加用户头像,如果有用户登出则删除用户头像
	EventUtils.listen(api.winName,'recieve_room_msg',false,function(data){
		var attendcount = data.attendcount;
		var concurrent = data.concurrent;
		
		$("#attendcount").html(attendcount);
		
		if(data.type == "login"){
			action.addOnlineAvatar(data);
		}else if(data.type == "logout"){
			action.removeOnlineAvatar(data);
		}
		
	});
	
	
	return;
}); 